//
//  IGBaseRequest.h
//  jingdongfang
//
//  Created by BOE on 2017/8/9.
//  Copyright © 2017年 ZhiYu Hao. All rights reserved.
//

#import <YTKNetwork/YTKNetwork.h>

/** api请求结果错误状态 */
typedef NS_ENUM(NSInteger, IGApiResultStatus) {
    IGApiResultStatusInit = 0,    //接口请求初始状态
    IGApiResultStatusStart = 1,   //接口请求开始状态
    IGApiResultStatusSuccess,     //接口请求成功
    IGApiResultStatusIOSException,//iOS代码错误
    IGApiResultStatusLogicErr,    //业务异常/业务失败
    IGApiResultStatusServerErr    //请求超时或者服务器异常---->提示请求超时
};

/// Block of request completion.
typedef void(^IGRequestCompletionBlock)(id responseObject, NSError *error);

@interface IGBaseRequest : YTKRequest

@property (nonatomic, assign) IGApiResultStatus resultStatus;
@property (nonatomic, strong) Class decodeClass;

- (void)startWithDecodeClass:(Class)decodeClass CompletionBlockWithSuccess:(IGRequestCompletionBlock)completion;

- (void)parseResponseObject:(id)responseObject
                      error:(NSError *)error
              completeBlock:(IGRequestCompletionBlock)completion;

/// 业务逻辑错误时(error.code == 4)是否弹出toast，默认YES.
- (BOOL)showLogicErrorToast;

/// 是否显示加载提示信息
- (BOOL)isNeedHub;

- (BOOL)isHttps;

- (NSString *)arrToJsonString:(NSArray *)arr;
    
@end
